home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: Gloger@lrz.uni-muenchen.de (Wolfram Gloger)
- Newsgroups: comp.sys.sgi.misc,comp.lang.c,comp.unix.programmer
- Subject: Re: memory management in UNIX (SGI IRIX)
- Date: 2 Feb 1996 13:02:03 GMT
- Organization: Universitaet Muenchen (Germany)
- Distribution: world
- Message-ID: <4et20b$q6i@sparcserver.lrz-muenchen.de>
- References: <DM0Jv9.9F4@bii.bruker.com>
- Reply-To: Gloger@lrz.uni-muenchen.de
- NNTP-Posting-Host: sun6.lrz-muenchen.de
-
- jem@bii.bruker.com (Joe Meier) writes:
-
- > We have a problem with a program running under UNIX (SGI IRIX 5.x).
- >It uses X11 for a graphical user interface.
- >The program allocates and frees large amounts of memory for data
- >(sometimes chunks as big as 20M). The problem is that in a relatively
- >short time the system runs out of swap sapce and we have to kill the program.
- >We have investigated the problem and it seems to be that the allocated memory
- >is getting segmented, so that even though the memory is freed by calls to
- >"free", the next malloc does not necessairly use the freed space because it
- >cannot find a large enough contiguous block and instead allocates more from
- >the system. When we were working with smaller data sizes this was not a
- >problem, but the bigger data sizes is causing some svere problems. The
- >first question is whether anyone else has encountered similar problems
- >and what caused them and how they solved it?
-
- The cause is most probably heap fragmentation. Conventional malloc()/free()
- implementations can only release contiguous regions of memory at the top of
- the heap, not anything in the middle.
-
- You might want to check out the `Free memory: Why isn't it doing anything ?'
- thread on comp.sys.sgi.misc. In short, try:
-
- ftp://g.oswego.edu:pub/misc/malloc-2.6.2.c
-
- and see if it makes a difference. This implementation uses mmap() on
- large chunks, which can be returned to the system immediately on a
- call to free().
-
- Regards,
- Wolfram.
-